package JavaBase.Polymorphism;

public class Circle extends Shape{

    private double radius;

    public Circle(double radius)
    {
        this.radius=radius;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    public void area()
    {
        if(this.radius<=0)
        {
            System.out.println("取值范围无意义！！！");
            System.exit(1);
        }

        System.out.println("半径："+this.radius+"\n圆的面积："
        +(Math.PI*this.radius*this.radius));
    }
}
